//
//  FluFactory.swift
//  Runner
//
//  Created by yfwl on 2024/1/18.
//

import Foundation
import Flutter

class FluFactory : NSObject , FlutterPlatformViewFactory{
    
    private var binaryMessenger : FlutterBinaryMessenger
    
    init(binaryMessenger : FlutterBinaryMessenger) {
        self.binaryMessenger = binaryMessenger
    }
    
    func create(withFrame frame: CGRect, viewIdentifier viewId: Int64, arguments args: Any?) -> FlutterPlatformView {
        let fluView = FluView.init(binaryMessenger: self.binaryMessenger, viewId: viewId, args: args)
        fluView.setMethodChannel()
        return fluView
    }
    
    func createArgsCodec() -> FlutterMessageCodec & NSObjectProtocol {
        return FlutterJSONMessageCodec.sharedInstance()
    }
}
